package com.example.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiafei.xu@xiaobao100.com
 * @description
 * @date 2020-01-21 10:18
 */
@Slf4j
@Validated
@RestController
public class HelloController {

    private Integer sleep = new Integer(0);

    @GetMapping("/hello")
    public String merchantCreditCodeInfo() {
        try {
            log.info("空闲时间{}", sleep);
//            Thread.sleep(0);
//            Thread.sleep(1);
//            Thread.sleep(2);
//            Thread.sleep(5);
            Thread.sleep(sleep);
//            Thread.sleep(50);
//            Thread.sleep(100);
//            Thread.sleep(500);
        } catch (InterruptedException e) {
            log.error("", e);
        }
        return "hello";
    }

    @GetMapping("/sleep/{sleepTime}")
    public String scpmerchantUseHttpClient(@PathVariable("sleepTime") Integer sleepTime) {
        sleep = sleepTime;
        return "hello";
    }

}